package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser;
import com.ruoyi.system.domain.DjiAirportBoundaryPosition;
import com.ruoyi.system.domain.vo.DjiAirportVo;
import com.ruoyi.system.mapper.DjiAirportBoundaryPositionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DjiAirportMapper;
import com.ruoyi.system.domain.DjiAirport;
import com.ruoyi.system.service.IDjiAirportService;

/**
 * 大疆机场Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-26
 */
@Service
public class DjiAirportServiceImpl implements IDjiAirportService 
{
    @Autowired
    private DjiAirportMapper djiAirportMapper;

    @Autowired
    private DjiAirportBoundaryPositionMapper positionMapper;

    /**
     * 查询大疆机场
     * 
     * @param id 大疆机场主键
     * @return 大疆机场
     */
    @Override
    public DjiAirportVo selectDjiAirportById(Long id)
    {
        return djiAirportMapper.selectDjiAirportById(id);
    }

    /**
     * 查询大疆机场列表
     * 
     * @param djiAirport 大疆机场
     * @return 大疆机场
     */
    @Override
    public List<DjiAirport> selectDjiAirportList(DjiAirport djiAirport)
    {
        return djiAirportMapper.selectDjiAirportList(djiAirport);
    }

    /**
     * 新增大疆机场
     * 
     * @param djiAirport 大疆机场
     * @return 结果
     */
    @Override
    public int insertDjiAirport(DjiAirport djiAirport)
    {
        djiAirport.setCreateTime(DateUtils.getNowDate());
        // 获取当前的用户
        LoginUser loginUser = SecurityUtils.getLoginUser();
//        djiAirport.setCreateBy(loginUser.getUserid()+"");
        return djiAirportMapper.insertDjiAirport(djiAirport);
    }

    /**
     * 修改大疆机场
     * 
     * @param djiAirport 大疆机场
     * @return 结果
     */
    @Override
    public int updateDjiAirport(DjiAirport djiAirport)
    {
        djiAirport.setUpdateTime(DateUtils.getNowDate());
        return djiAirportMapper.updateDjiAirport(djiAirport);
    }

    /**
     * 批量删除大疆机场
     * 
     * @param ids 需要删除的大疆机场主键
     * @return 结果
     */
    @Override
    public int deleteDjiAirportByIds(Long[] ids)
    {
        return djiAirportMapper.deleteDjiAirportByIds(ids);
    }

    /**
     * 删除大疆机场信息
     * 
     * @param id 大疆机场主键
     * @return 结果
     */
    @Override
    public int deleteDjiAirportById(Long id)
    {
        return djiAirportMapper.deleteDjiAirportById(id);
    }

    @Override
    public int savePosition(DjiAirportBoundaryPosition boundaryPosition) {
        return positionMapper.insertDjiAirportBoundaryPosition(boundaryPosition);
    }

    @Override
    public List<DjiAirport> selectDjiAirportListAll(DjiAirport djiAirport) {

       return djiAirportMapper.selectDjiAirportListAll(djiAirport);
    }
}
